package com.shanzmoo.core.config;

import cn.hutool.extra.mail.MailAccount;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * core模块自动装配
 * @author: fs
 */
@Configuration
@ComponentScan({"com.shanzmoo.core"})
@RequiredArgsConstructor
public class CoreAutoConfiguration {
    private final MailProperties mailProperties;
    /**
     * 邮箱用户
     */
    @Bean(name="mailAccount")
    public MailAccount mailAccount(){
        MailAccount ma = new MailAccount();
        ma.setUser(mailProperties.getUser());
        ma.setPass(mailProperties.getPass());
        ma.setHost(mailProperties.getHost());
        ma.setPort(mailProperties.getPort());
        ma.setSslEnable(mailProperties.getSsl());
        ma.setFrom(mailProperties.getUser());
        return ma;
    }
}
